using Kassandra.Core;
using Kassandra.Core.WordWrapper;
using NUnit.Framework;
using Rhino.Mocks;

namespace Kassandra.Tests
{
    [TestFixture]
    public class ProcessFileTests
    {
        private MockRepository _mockery;

        [TestFixtureSetUp]
        public void Setup()
        {
            _mockery = new MockRepository();
        }

        [TestFixtureTearDown]
        public void TearDown()
        {
        }

        [Test]
        public void Should_load_the_original_file()
        {
            IWord97Wrapper mockWord97Wrapper = _mockery.DynamicMock<IWord97Wrapper>();
            ITranslate mockTranslator = _mockery.DynamicMock<ITranslate>();

            using (_mockery.Record())
            {
                mockWord97Wrapper.Load(string.Empty);
                LastCall.IgnoreArguments().Repeat.Once();
            }

            using (_mockery.Playback())
            {
                ProcessFile processor = new ProcessFile(mockWord97Wrapper, mockTranslator);
                processor.With(string.Empty, string.Empty);
            }
        }

        [Test]
        public void Should_save_as_an_Xml_document()
        {
            IWord97Wrapper mockWord97Wrapper = _mockery.DynamicMock<IWord97Wrapper>();
            ITranslate mockTranslator = _mockery.DynamicMock<ITranslate>();


            using (_mockery.Record())
            {
                mockWord97Wrapper.SaveAsXmlDocument(string.Empty);
                LastCall.IgnoreArguments().Repeat.Once();
            }

            using (_mockery.Playback())
            {
                ProcessFile processor = new ProcessFile(mockWord97Wrapper, mockTranslator);
                processor.With(string.Empty,string.Empty);
            }
        }

        [Test]
        public void Should_translate_document()
        {
            IWord97Wrapper mockWord97Wrapper = _mockery.DynamicMock<IWord97Wrapper>();
            ITranslate mockTranslator = _mockery.DynamicMock<ITranslate>();

            using (_mockery.Record())
            {
                mockTranslator.For(string.Empty, string.Empty);
                LastCall.IgnoreArguments().Repeat.Once();
            }

            using (_mockery.Playback())
            {
                ProcessFile processor = new ProcessFile(mockWord97Wrapper, mockTranslator);
                processor.With(string.Empty, string.Empty);
            }
        }
    }
}